#include <algorithm>
#include <iostream>
using namespace std;
int n, x, y;
int cnt = 0;
int main() {
    cin >> n;
    int nums[n];
    for (int i = 0; i < n; i++) cin >> nums[i];
    cin >> x >> y;
    sort(nums, nums + n);
    cnt += nums[y] - nums[y - 1] - 1;
    cnt++;
    cout << cnt << endl;
    return 0;
}